package com.senlingspace.payment.enums;

/**
 * 团购类型（团餐券/代金券）
 *
 * @author lebronjames
 * @date 2024/07/24
 */
public enum DouyinGrouponTypeEnum {

    UNKNOWN(-1, "未知"),

    GROUPON(1, "团购"),

    VOUCHER(2, "代金券"),

    TIMES_CARD(3, "次卡");

    private final int code;
    private final String desc;

    DouyinGrouponTypeEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public int getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static DouyinGrouponTypeEnum getGrouponType(int code) {
        for (DouyinGrouponTypeEnum grouponTypeEnum : DouyinGrouponTypeEnum.values()) {
            if (grouponTypeEnum.getCode() == code) {
                return grouponTypeEnum;
            }
        }
        return UNKNOWN;
    }

}
